define(function(require, exports, module) {
    var ALL = require("../../common/all"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Init = ALL.Init;


    var _vm = Init.initVue({
        data : {
            list : [],
            cur : 1,
            all : 0,
            schFlag : false,
            search : {
                phone : "",
                no : "",
                team_sn : "",
                platform : "all",
                register_start : "",
                register_end : "",
                auth_start : "",
                auth_end : "",
                bindcard_start : "",
                bindcard_end : "",
            }
        },
        methods: {
            reSearch : function() {
                this.schFlag = true;
                this.getData(1);
            },
            reset : function() {
                this.schFlag = false;
                this.search.phone = "";
                this.search.no = "";
                this.search.team_sn = "";
                this.search.platform = "all";
                this.search.register_start = "";
                this.search.register_end = "";
                this.search.auth_start = "";
                this.search.auth_end = "";
                this.search.bindcard_start = "";
                this.search.bindcard_end = "";
            },
            getData : function(n) {

                if (_vm.schFlag) {
                    if (_vm.search.register_start > _vm.search.register_end) {
                        METHOD.alert("注册开始日期不能早于结束日期，请重新设置。")
                        return;
                    } else if (_vm.search.auth_start > _vm.search.auth_end) {
                        METHOD.alert("认证开始日期不能早于结束日期，请重新设置。")
                        return;
                    } else if (_vm.search.bindcard_start > _vm.search.bindcard_end) {
                        METHOD.alert("绑卡开始日期不能早于结束日期，请重新设置。")
                        return;
                    }
                }

                _vm.search.page = n;
                _vm.search.num = 10;

                METHOD.loading.show();
                METHOD.ajax("user/list", _vm.search).done(function(json){
                    METHOD.loading.hide();
                    _vm.list = json.data;
                    _vm.all = json.page.pages;
                }).fail(function(){
                    METHOD.loading.hide();
                });
            }
        }
    });

    _vm.getData(1);

});

